package com.hxgis.oc.config;

import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.File;

@Component
public class OConfigInstance {
    @Getter
    @Value("${oc.fdb}")
    private String[] fdb;

    @Getter
    @Value("${oc.app}")
    private String oCApplication;

    @Value("${oc.config.dataDir}")
    private String dataDir;
    private boolean dataDirFileCreated;
    public String getDataDir(){
        if(!dataDirFileCreated){
            dataDirFileCreated = true;
            File file = new File(dataDir);
            file.mkdir();
            dataDir = file.getAbsolutePath();
        }
        return dataDir;
    }

    @Getter
    @Value("${oc.config.cacheDir}")
    private String cacheDir;

    @Getter
    @Value("${oc.gdalPath}")
    private String gdalPath;

    @Getter
    @Value("${oc.shpPath}")
    private String shpPath;

    @Getter
    @Value("${product.w3dm}")
    private String[] productW3dm;

    @Getter
    @Value("${product.png}")
    private String[] productPNG;

    @Getter
    @Value("${product.file}")
    private String[] productFile;

    @Getter
    @Value("${product.geojson}")
    private String[] productGeojson;

    @Getter
    @Value("${product.idw}")
    private String[] productIDW;

    @Getter
    @Value("${product.ws}")
    private String[] productWS;

    @Getter
    @Value("${product.live}")
    private String[] productLive;

    @Getter
    @Value("${ncep.timer.enable}")
    private boolean ncepTimerEnable;
}
